(function($, window, document, undefined) {
  
  $(document).on('click', '.download-tab-item', function(e) {
    e.preventDefault()

    var $el = $(e.target)

    if (!$el.is('.download-tab-item')) {
      $el = $el.parents('.download-tab-item')
    }

    var index = $el.index()

    $el
      .addClass('active')
      .siblings()
      .removeClass('active')

    $('.download-panel-item')
      .eq(index)
      .addClass('active')
      .siblings()
      .removeClass('active')

  })

})(jQuery, window, document)